
#ifndef IQW_GUI_LAYOUT_H__
#define IQW_GUI_LAYOUT_H__

#include <stdint.h> 

#include "iqw_gui_widget.h"


typedef struct iqw_gui_layout_fling_s {
    int16_t min;
    int16_t max;
    int16_t itemHeight; // item 高度
    int16_t speed; // total 
    int16_t t; // 
    uint16_t status;
    bool enabled; 
    struct iqw_gui_layout_fling_s *next; 
}iqw_gui_layout_fling_t; 


// fling function 
void iqw_gui_layout_set_local_fling( iqw_gui_layout_fling_t* fling);
bool iqw_gui_layout_get_local_fling_is_enabled(void); 

bool iqw_gui_layout_fling_is_disabled( iqw_gui_layout_fling_t* fling);

bool iqw_gui_layout_fling_check_is_idle(iqw_gui_layout_fling_t *fling);

void iqw_gui_layout_fling_on_touch_press(iqw_gui_layout_fling_t* fling);

void iqw_gui_layout_fling_on_touch_release(iqw_gui_layout_fling_t* fling);

void iqw_gui_layout_fling_init(iqw_gui_layout_fling_t *fling, int16_t min, int16_t max, int16_t itemheight);

void iqw_gui_layout_fling_set(iqw_gui_layout_fling_t *fling, int16_t speed );

void iqw_gui_layout_fling_update( iqw_gui_layout_fling_t* fling, int16_t cur_offset, int16_t* axis_delta );

void iqw_gui_layout_fling_set_stop( iqw_gui_layout_fling_t* fling); 

void iqw_gui_layout_fling_switch_item( iqw_gui_layout_fling_t* fling, bool neg); 

void iqw_gui_layout_fling_set_disable( iqw_gui_layout_fling_t* fling ); 


// others layout function 
void iqw_gui_layout_update_roll(ui_widgets_type_t *widgets, int cnt, int16_t delta_y);


void iqw_gui_layout_get_y_of_general( int16_t y, int16_t h, int16_t* x); 

void iqw_gui_layout_update_general_container(ui_widgets_type_t *widgets, int cnt, int16_t delta_y, uint16_t type); 

void iqw_gui_layout_update_stopwatch_container( ui_widgets_type_t *widgets, int cnt, int16_t delta_y, uint16_t type);

void iqw_gui_layout_update_exercise_container( ui_widgets_type_t * widgets, int cnt, int16_t delta_y, uint16_t type);

#endif 

